package com.xu.cloud.common.exception;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * 基础异常类
 *
 * @author xuguan
 * @since 2023/3/30
 */
@Slf4j
@Getter
@EqualsAndHashCode(callSuper = true)
public class XuCloudException extends RuntimeException {

    private static final long serialVersionUID = -3101242147041071008L;

    private final String code;

    public XuCloudException(String code, String message) {
        super(message);
        this.code = code;
    }

    public XuCloudException(String code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    @Override
    public String toString() {
        return "XuCloudException{" +
                "code='" + code + '\'' +
                ", message='" + super.getMessage() + '\'' +
                '}';
    }
}
